import ctypes
# from progress.bar import ChargingBar
import time


class Complex():
    """复数"""
    def __init__(self, realpart, imagpart):
        self.r = realpart
        self.i = imagpart
    
    def display(self):
        print(self.r, "+", self.i, "\bi")


def get_dpi():
    """【函 数】获取屏幕DPI
    """
    # 运行成功，但是得出的数据并不正确
    screen_width = ctypes.windll.user32.GetSystemMetrics(0)
    screen_height = ctypes.windll.user32.GetSystemMetrics(1)
    print(screen_width, screen_height)


def plus(jiashu_1: int, jiashu_2: int):
    print(jiashu_1)
    print(jiashu_2)


def test_progressbar():
    """测试进度条"""
    ins_chargeingbar = ChargingBar("已完成:", max=10)
    for i in range(10):
        time.sleep(1)
        # print("\nExtract: system.exe")
        # print("Extract: programfile")
        ins_chargeingbar.next()
    ins_chargeingbar.finish()
    return 0


def test_if():
    """测试if的判断条件如果是非布尔值会怎样"""
    dict_A = (1,2)
    if (dict_A):
        print("分支A")
        print(dict_A)
        print(bool(dict_A))
        print(bool(None))
        # 这可能解释了为什么可以用非布尔值来充当if的判断条件：存在的类型为True，不存在的数据为False
    else:
        print("分支B")
    return 0


if (__name__ == "__main__"):

    x = Complex(3, 4)
    x.display()

    get_dpi()

    test_if()
